home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Plus 1995 #1
/
Amiga Plus 1995 #1.iso
/
fish-disketten
/
fish_691-700
/
d695
/
icalc
/
docs
/
history
< prev
next >
Wrap
Text File
|
1994-12-13
|
7KB
|
206 lines
=============================================================================
icalc - a complex-number expression parser
by Martin W Scott
=============================================================================
Revision History,
and Things To Do.
=============================================================================
To Add
------
PROBLEM - function, f say, defined initially, then some other fn g
defined using f. f is redefined, incorrectly at first, thereby
deleting it from sym-table, until defined correctly. But
pointers in g now point to nothing...
This indicates need for reference count within symbols...
- break, continue constructs.
- print function which takes strings and format values.
- error construct. Very similar to print...
Version 2.0
-----------
- new and revised scripts - see documents for details.
- writevars "file" writes all variables and arrays to specified
file in such a way that it can subsequently be read by a 'read'
command or as an argument to icalc.
- exec "str" command added, passes string to system()
ie. runs command specified in str. eg. exec 'run dme'
Also, cd "str" and pwd commands added.
- local vars available for functions via local statement.
- 1d-arrays added - see docs for details.
- clear <SYM> where sym is function or variable (or array)
frees all memory, deletes entry in table. Use with care, doesn't
check if SYM is referred to elsewhere.
- startup-file optionally specified in env-var ICALCINIT.
- read <name> command, so you can read files from other files
(like #include) and interactively. Makes writing and debugging
of compilcated functions much easier.
- Functions can take expressions as parameters, ie. parameters need
not be evaluated on calling, but only on reference; this can be
a powerful tool in function definition - see docs.
- More freedom about putting new-lines in expressions to aid clarity.
See docs for details. Still not free-form though, because of the
interactive nature of icalc.
- if-then and if-then-else constructs added.
- while-do and repeat-until constructs added - see docs for details.
To facilitate infinite loops (which would probably print() values),
the constants TRUE and FALSE have been added. Also added INFINITY
constant, which represents the largest possible value that can be
used.
- [internal: changed over to Berkeley Yacc from Bison, because
the latter didn't seem to understand %nonassoc operator type.]
- [Bugette: a = 3 && b = 4 is valid - parses as a = (3 && (b = 4))
instead (I would have thought) as a = (3 && 4) = b (ie. nonesense).
Something wrong with precedence of right-to-left ops in Bison/Yacc?
Or a grammar that just can't be dealt with by Bison/Yacc?]
- [Internal: binary ops have node set to call-function - quicker than
case lookup in eval_tree().]
- Exponentiation operator ^ now sensitive to operands, ie. doesn't
just use complex-number formula, but chooses method depending on
operands. Thus, realno^realno = realno + 0i. Quicker in most
cases now.
- BUG FIX: files are now closed upon being read, rather than at
program termination.
- BUG FIX: can now assign to parameters in function definition (for
what it's worth...).
- BUG FIX: all arguments to functions are now evaluated from left
to right; previously, this was the case for builtin functions,
but not user-defined functions.
- Recursive functions may now be written, but program stack grows
quickly - I'm working on reducing it.
- Addition of ternary operator ?: with usage as in C (see docs).
- Addition of +=, *= etc. operators.
- Addition of relational operators > , >=, <, <=, ==, != and logical
operators &&, ||, ! (negation). && and || use short-circuit
evaluation, ala C.
- Abort trap now set, so you can ^C out of long calculations :-)
Doesn't slow things down too much.
Version 1.1a
------------
- BUG FIX: The inverse trigonometric functions asin, acos, atan now
return values in the conventionally regarded PVR's. They should
also work all the time now (unlike in the last release).
- BUG FIX: Fixed major bug whereby sqrt(z) didn't return values in
the correct quadrant for PVR of (-PI,PI]. Not only did this affect
the sqrt function, but also all functions defined using sqrt
(internally and in scripts), including inverse trig. functions.
- Addition of max and min functions, which take a variable number
of arguments and return respectively the value of the maximum
or minimum REAL part encountered.
- Addition of a time() builtin. This allows timings of operations
to be made. time(t) = current time - t.
- Addition of sgn() builtin, which returns the sign (-1,0,1) of the
REAL part of its argument.
- Modified definitions of int, floor, ceil to only act on REAL part of
their arguments, so to get floor of imag. part, say floor(Im(z)).
- Revised icalc.init file, with more definitions.
- BUG FIX: Corrected stupid mistake in definition of polar(r,theta)
function in icalc.init.
Version 1.1
-----------
- Example script files modified. Now provided are:
icalc.init, which has many useful functions (startup-file);
trig.icalc, which contains less-used trig functions;
stat.icalc, one-variable statistical analysis.
You are strongly recommended to look at these for tips on how
best to use icalc.
- On startup, icalc will now read the file 's:icalc.init' if it
exists.
- Special function multi() added, which evaluates all its arguments,
returning the last one as its value. See docs and example scripts
for applications. Also added is print() builtin, for use
with multi().
- Special functions Sum(), Prod(), every() and vevery() now added.
The repeat construct has therefore been removed. (It was only
in there until I got around to adding this type of facility).
- Expressions and function definitions may now be continued on
the next line by use of a backslash '\'.
- Identifiers may begin with and contain underscores (and, as a
side-effect of the implementation, be composed entirely of
underscores).
- Multi-parameter functions now added.
- You can now declare functions that take no parameters, eg.
func total() = sum1 + sum2
- Listing of user functions improved: now shows parameter list;
However, I don't think it's worth writing out whole definition.
- Method of setting precision has changed: now use function
prec(digits), which returns ans (last computed result). Initially
set to 8.
- Added function int(z), which returns the real and imaginary parts
of z rounded to nearest integers; 0.5 rounds up.
- Added functions ceil(z) and floor(z), which operate separately
on the real and imaginary parts of their argument, in a similar
manner to int(z).
- Now has a prompt to avoid confusion.
- [Real-valued functions are no longer computed internally as such.]
- Removed debugging code accidentally left in with version 1.0.
Version 1.0
-----------
- Initial release.